import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:bobang/constant.dart';
import 'package:bobang/router.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return AdaptiveTheme(
      light: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      dark: ThemeData.dark(
        useMaterial3: true,
      ),
      initial: AdaptiveThemeMode.light,
      builder: (theme, darkTheme) => GetMaterialApp(
        title: Constant.appName,
        theme: theme,
        darkTheme: darkTheme,
        defaultTransition: Transition.cupertino,
        initialRoute: AppRouter.home,
        getPages: AppRouter.routers,
        // home: HomePage(),
        builder: (context, widget) {
          /// 设置字体不跟随系统字体大小
          return GestureDetector(
            onTap: Get.focusScope?.unfocus,
            child: MediaQuery(
                data: MediaQuery.of(context)
                    .copyWith(textScaler: TextScaler.noScaling),
                child: widget!),
          );
        },
      ),
    );
  }
}
